﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Model.Sec
{
    /// <summary>
    /// 用户组集合类
    /// </summary>
    public class UserGroupCollection :IListSource
    {
        UserGroup[] userGroups;
        private int _Count;

        bool IListSource.ContainsListCollection
        {
            get { return false; }
        }
        System.Collections.IList IListSource.GetList()
        {

            BindingList<UserGroup> blu = new BindingList<UserGroup>();
       
            foreach (UserGroup  usergroup in userGroups)
                
	        {
		                 blu.Add(usergroup);
	         }
            return blu;
  
        }
        /// <summary>
        /// 用户组集合类的构造函数
        /// </summary>

        public UserGroupCollection(int count)
        {
            this._Count = count;
            userGroups= new UserGroup[this._Count];

        }
        /// <summary>
        /// 集合的长度
        /// </summary>
        public int count
        {
            get { return userGroups.Length; }
        }
        /// <summary>
        /// 获取或设置索引为index的用户对象
        /// </summary>
        /// <param name="index">索引值</param>
        /// <returns>usergroup 对象</returns>
        public UserGroup this[int index]
        {
            get { return userGroups[index]; }
            set { userGroups[index] = value; }
        
        }
        public UserGroup[] Usergroups
        {
            get { return this.userGroups; }
        }

    }
}
